package com.shcd.controller;

import com.shcd.service.DataLifeCycleService;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@CrossOrigin
@RestController
@RequestMapping("LogVisualization")
public class DataLifeCycleController {
    private final DataLifeCycleService dataLifeCycleService;

    @Autowired
    public DataLifeCycleController(DataLifeCycleService dataLifeCycleService) {
        this.dataLifeCycleService = dataLifeCycleService;
    }

    //手动调用定时
    @PostMapping("insertLogMain")
    public void logMain(@RequestBody Map<String, String> params){
        dataLifeCycleService.InsertMain(params.get("day"));
    }

    @PostMapping("getSum_LOG_EXCHANGE")
    public String getSum_LOG_EXCHANGE(@RequestBody JSONObject o){
        return dataLifeCycleService.SelectSum_LOG_EXCHANGE(o);
    }

    @PostMapping("getLOG_EXCHANGE")
    public String getLOG_EXCHANGE(@RequestBody JSONObject o){
        return dataLifeCycleService.SelectLOG_EXCHANGEbyInserttime(o);
    }

    @PostMapping("getDescribe_LOG_EXCHANGE")
    public String getDescribe_LOG_EXCHANGE(@RequestBody JSONObject o){
        return dataLifeCycleService.SelectDescribe_LOG_EXCHANGE(o);
    }

    //手动调用定时
    @PostMapping("Insert_queryLogList")
    public void Insert_queryLogList(@RequestBody JSONObject o){
        dataLifeCycleService.Insert_queryLogList(o);
    }

    @PostMapping("queryLogList")
    public String  queryLogList(@RequestBody JSONObject o){
        return dataLifeCycleService.queryLogList(o);
    }
}
